<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('首页轮播列表')" />
    <style>
        .img-circle {
            border-radius: 5%;
        }

        .img-xs {
            width: 70px;
            height: 35px;
        }
    </style>
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="add()" shiro:hasPermission="wechat:WxBanner:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('wechat:WxBanner:edit')}]];
        var removeFlag = [[${@permission.hasPermi('wechat:WxBanner:remove')}]];
        var bannerLinkTypeDatas = [[${@dict.getType('banner_link_type')}]];
        var prefix = ctx + "wechat/WxBanner";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                removeUrl: prefix + "/remove",
                modalName: "首页轮播",
                columns: [
                {
                    field: 'bannerId',
                    title: '编号',
                    visible: false,
                    sortable: false
                },
                    {
                        field: 'bannerPic',
                        title: '图片',
                        sortable: false,
                        formatter: function (value, row, index) {
                            return $.table.imageView(value, 200);
                        }
                    },
                {
                    field: 'bannerLinkType',
                    title: '跳转类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(bannerLinkTypeDatas, value);
                    }
                },
                {
                    field: 'targetName',
                    title: '目标',
                    sortable: false
                },
                {
                    field: 'bannerSort',
                    title: '排序',
                    sortable: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.bannerId + '\')">删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function add(){
            $.modal.open("添加", prefix + "/add",600,700)
        }
    </script>
</body>
</html>
